package com.sesxh.project.knowledge.router;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.sesxh.frame.web.controller.BaseController;
import com.sesxh.project.knowledge.biz.dto.SearchDto;
import com.sesxh.project.knowledge.biz.model.Knowledge;
import com.sesxh.project.knowledge.biz.service.IKnowledgeService;
import com.sesxh.project.knowledge.biz.service.impl.KnowledgeSearchService;

@RestController
@RequestMapping("/search")
public class ContentSearchContorller implements BaseController {

	@Autowired
	KnowledgeSearchService knowledgeSearchService;
	@Autowired
	IKnowledgeService knowledgeService;
	
	@RequestMapping(value = "/knowledge", method = {RequestMethod.POST,RequestMethod.GET},produces=MediaType.APPLICATION_JSON_UTF8_VALUE)
	public @ResponseBody Object searchContent(SearchDto searchDto) {
	
		List<Long> ids=knowledgeSearchService.searchContentIds(searchDto);
		
		List<Knowledge> contenList= knowledgeService.loadKnowledgeByIds(ids);
		
		return ajaxQuery("contenList", contenList);
	}



}
